/**
 * 
 */
package com.aq.actions;

/**
 * @author shl
 *
 */
import java.util.Collection;

import org.apache.commons.lang.StringUtils;

import com.aq.model.AqNews;
import com.aq.model.AqSolvtion;
import com.aq.service.INewsService;
import com.aq.service.ISolvtionService;
import com.hs.common.page.PageParam;
import com.hs.common.page.PageUtil;
import com.hs.core.action.AbstractAction;

public class SolvtionAction extends AbstractAction {
    
    private ISolvtionService solvtionService;  
    private AqSolvtion solvtion; 
    
    protected Collection availableItems;
    protected String pageStr;
    
    protected PageUtil pageUtil;  
    protected Long solvtionid;
    
    public String list() throws Exception {
    	
    	PageParam pageParam = new PageParam(this.getHttpServletRequest(),"listNews.action");
		String hql = " from AqSolvtion where 1=1";
		pageParam.setSearchSql(hql);
		pageUtil = solvtionService.getSolvtionList(pageParam);
		availableItems = pageUtil.getPageList();
		pageStr = pageUtil.getPageStr();
//		System.out.println("pageStr:" + pageStr);
        return SUCCESS;         
    }
    
    public String load() throws Exception {
    	String solvtionid = this.getHttpServletRequest().getParameter("solvtionid");
    	if(StringUtils.isNotEmpty(solvtionid)){
    		setSolvtionid(new Long(solvtionid));
    		this.solvtion = (AqSolvtion)solvtionService.findByID(AqSolvtion.class, this.getSolvtionid());
    		//setContent(this.solvtion.getContent() == null?"":this.solvtion.getContent());
    	} 
    	
        return SUCCESS;
    }
    
    public String save() throws Exception { 
    	 
    	if(null != solvtion){ 
    		solvtionService.saveObject(solvtion); 
    	}
        return SUCCESS;
    }
    
    public String delete() throws Exception {
       
        return SUCCESS;
    }     
    public Collection getAvailableItems() {
        return availableItems;
    }

	public ISolvtionService getSolvtionService() {
		return solvtionService;
	}

	public void setSolvtionService(ISolvtionService solvtionService) {
		this.solvtionService = solvtionService;
	}

	public AqSolvtion getSolvtion() {
		return solvtion;
	}

	public void setSolvtion(AqSolvtion solvtion) {
		this.solvtion = solvtion;
	}

	public String getPageStr() {
		return pageStr;
	}

	public void setPageStr(String pageStr) {
		this.pageStr = pageStr;
	}

	public PageUtil getPageUtil() {
		return pageUtil;
	}

	public void setPageUtil(PageUtil pageUtil) {
		this.pageUtil = pageUtil;
	}

	public Long getSolvtionid() {
		return solvtionid;
	}

	public void setSolvtionid(Long solvtionid) {
		this.solvtionid = solvtionid;
	}

	public void setAvailableItems(Collection availableItems) {
		this.availableItems = availableItems;
	}
    
    
}
